home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20020314-20021006 / 000371_mswarbrick@rentokil.com_Wed Sep 18 09:27:51 EDT 2002.msg < prev    next >
Text File  |  2020-01-01  |  4KB  |  107 lines

  1. Article: 13705 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!panix!bloom-beacon.mit.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail
  3. From: mswarbrick@rentokil.com (Mark Swarbrick)
  4. Newsgroups: comp.protocols.kermit.misc
  5. Subject: Re: scripting to a serial sms modem - idiot question!
  6. Date: 18 Sep 2002 04:09:11 -0700
  7. Organization: http://groups.google.com/
  8. Lines: 88
  9. Message-ID: <e516d9ec.0209180309.320f7dad@posting.google.com>
  10. References: <e516d9ec.0209160537.450ca7b@posting.google.com> <am4nq6$p5i$1@watsol.cc.columbia.edu>
  11. NNTP-Posting-Host: 213.2.60.82
  12. Content-Type: text/plain; charset=ISO-8859-1
  13. Content-Transfer-Encoding: 8bit
  14. X-Trace: posting.google.com 1032347351 8578 127.0.0.1 (18 Sep 2002 11:09:11 GMT)
  15. X-Complaints-To: groups-abuse@google.com
  16. NNTP-Posting-Date: 18 Sep 2002 11:09:11 GMT
  17. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13705
  18.  
  19. > Read it, finish your script, then send it in and we'll include it in the
  20. > script library since SMS seems to be such a popular service these days.
  21.  
  22. Hello.
  23.  
  24. I have finished the script. I'm very sorry for asking about 'connect'
  25. i bet you get fed up of that one. I had realised connect wouldn't
  26. work, but wasn't getting any joy out of the output command as i needed
  27. to send control chars etc and the modem didn't like the fast char rate
  28. either!
  29.  
  30. The modem used is a siemens tc35 terminal. SMS commands may vary. I am
  31. now working on two way scripts so that actions can be performed on the
  32. pc depending on the text of a message, then a specific message sent
  33. back. Eg if i text uptime to the sms box, i want a text message back
  34. with the uptime of the server. Now i've just got to learn some more
  35. i/o commands!
  36.  
  37. The setup is primative, but it's just to test basic functionality and
  38. i'm sure an event based setup would be a lot better but...
  39.  
  40. There is a website which has two dialogue boxes for number and
  41. message. This will then write a physical file on the outward facing
  42. webserver. This file contains the number and message wrapped with the
  43. correct string
  44.  
  45. eg lineout at+cmgs"+44123456789"
  46.  
  47. The internal machine with the sms modem attached runs a script from a
  48. cron every minute.
  49.  
  50. -----------
  51. #!/bin/bash
  52.  
  53. #runs ftp commands from the ftpget file to get msg file off remote
  54. webserver
  55. /bin/cat /tmp/ftpget | /usr/bin/ftp -i -n     
  56.  
  57. #runs another script which appends a header and footer to the message
  58. file. The #header is just stuff like the kerbang line and setting the
  59. modem port/speed #etc. The footer is simply a quit statement.
  60. /tmp/batchscript.sh
  61.  
  62. #outbox.sms is created which contains the full command list needed to
  63. send the #sms
  64. chmod +x /tmp/outbox.sms
  65.  
  66. #Execute the kermit kebang script
  67. /tmp/outbox.sms
  68. echo y|rm /tmp/outbox.sms
  69. -------------
  70.  
  71. The final outbox.sms file looks like this:
  72.  
  73. #!/usr/bin/kermit
  74. set modem type usr
  75. set line /dev/ttyS0
  76. set speed 9600
  77. set carrier-watch off
  78. set input echo on
  79. lineout at
  80. input 20 ok
  81. lineout AT+CMGF=1
  82. input 20 ok
  83. lineout AT+CMGS="+447747603208"^M
  84. input 20 >^M
  85. lineout 1^M
  86. output \26^M
  87. input 100 ok
  88. lineout AT+CMGS="+447747603208"^M
  89. input 20 >^M
  90. lineout 2^M
  91. output \26^M
  92. input 100 ok
  93. lineout AT+CMGS="+447747603208"^M
  94. input 20 >^M
  95. lineout 3^M
  96. output \26^M
  97. quit
  98.  
  99. In this example 3 messages are sent, with the text '1','2','3'
  100. respectively.
  101.  
  102. I'm sure my code is crap and there is an easier way to do it, but i'm
  103. new to scripting so go easy!
  104.  
  105. hope this helps someone, let me know what you think frank and if
  106. you've got any links that might be useful!
  107.